﻿#ifndef GLOBAL_H
#define GLOBAL_H
#include <QDebug>

#define SENSOR_TYPES 2 //sensor nums
#define SENSOR_G_NUMS 4
#define SENSOR_Y_NUMS 9
#define MAX_SPACE 2560
#define MAX_STATIONS_NUMS 5
enum NetState
{
    NET_NO_START,
    NET_CONNECTING,
    NET_CONNECTED,
    NET_UNREACHED,
    NET_DISCONNECTED,
    NET_N_NETSTATE
};
enum UARTState
{
    UART_NO_START,
    UART_OPEN,
    UART_CLOSED,
    UART_OPEN_ERROR,
    UART_N_UARTSTATE
};
enum SQLState
{
    SQL_NO_START,
    SQL_CONNECTED,
    SQL_DISCONNECTED,
    SQL_N_SQLSTATE
};
enum DataType{
	DATA_G,
	DATA_Y,
	DATA_V
};
enum DataWindows
{
    G_WINDOW_1 = 0,
    G_WINDOW_2 = 1, 
	G_WINDOW_3 = 2,
	G_WINDOW_4 = 3, 

	Y_WINDOW_1 = 4,
	Y_WINDOW_2 = 5, 
	Y_WINDOW_3 = 6,
	Y_WINDOW_4 = 7, 
	Y_WINDOW_5 = 8,
	Y_WINDOW_6 = 9, 
	Y_WINDOW_7 = 10,
	Y_WINDOW_8 = 11,
	Y_WINDOW_9 = 12,
	VOLTAGE = 13, 
	FORECAST = 14,
    N_WINDOWS = 15
};
enum Leds
{
    SOFT_SYSTEM_LED,
    MYSQL_LED,
    TCPSERVER_LED,
    UART_LED,
    N_LEDS //4
};

#define AT QString("AT\r\n")
#define TEXT QString("AT+CMGF=1\r\n")
#define ECHO QString("AT+CNMI=2,1\r\n")
#define READ(n) (QString("AT+CMGR=")+QString::number(n)+ QString("\r\n"))
#define DELONE(n)	(QString("AT+CMGD=")+QString::number(n)+ QString("\r\n"))
#define DELALL	QString("AT+CMGDA=\"DEL ALL\"\r\n")
#define LISTALL	QString("AT+CMGL=\"ALL\"\r\n")

#define SQL_TABLE QString("test")
#define SQL_G QString("table_gangjingji")
#define SQL_Y QString("table_yingli")
#define SQL_V QString("table_voltage")
#define SENSOR_TABLE QString("table_sensors")
#define STATIONS_TABLE QString("table_stations")
enum MsgError{
	SF = -1,
	CF = -2,
	SW = -3,
	RF = -4,
	UnKnowError = -5
};
#endif 
